PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Parameters That Specify Locations

Many commands have parameters that specify locations. A location can be either an insertion point or another object. An insertion point is a location where an object can be added. An object, when used as a location parameter, is an object to be replaced by another object.

For example, in the following statement, the to parameter specifies the location to which to move the first word. The value of the to parameter of the Move command is the reference before word 10 of text body, which is an insertion point.

tell front document of application "AppleWorks"
    move word 1 of text body to before word 10 of text body
end tell

The following example gets a reference to a document's selected text, then moves the first word of the document to the location of the selected text. The value of the to parameter of the Move command is an object, selectedText, which is replaced with word 1 .

tell application "AppleWorks"
    tell document "Simple"
        set selectedText to selection
        move word 1 of text body to selectedText
    end tell
end tell

Phrases such as word 1 and before word 10 are called index references and relative references, respectively. These kinds of references specify locations. For more information about these kinds of references, see Index and Relative.


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)